/*
 * Calculator.java : This class gets information from user and do a simple division,
*		 	multiplying, adding and subtraction actions and shows them to user.
* @Author : BilCIS
*/

public class Calculator 
{
	//properties
    private int storedNum; 
    
    //constructor
    public Calculator () 
    {
        storedNum = 0;
    }
    
    //get and set methods
    public String getTotalString() 
    {
        return "" + storedNum;
    }
    
    public void setTotal(String n) 
    {
        storedNum = convertToNumber(n);
    }
    
    public void add(String n) 
    {
        storedNum += convertToNumber(n);
    }
    
    public void subtract(String n) 
    {
        storedNum -= convertToNumber(n);
    }
    
    public void multiply(String n) 
    {
        storedNum *= convertToNumber(n);
    }
    
    public void divide(String n) 
    {
        storedNum /= convertToNumber(n);
    }
    
    private int convertToNumber(String n) 
    {
        return Integer.parseInt(n);
    }
}
